package Day08.Demo02;

/**
 * @author HYHwtx
 * @version 1.0
 * @date 2022/2/14 14:32
 */
public class Demo06StringPractise {
    public static void main(String[] args) {
        int[] array = {1, 2, 3};
        String result = fromArrayToString(array);
        System.out.println(result);
    }

    public static String fromArrayToString(int[] array) {
        String str = "[";
        for (int i = 0; i < array.length; i++) {
            if (i == array.length - 1) {//判断是不是最后一个
                str += "word" + array[i] + "]";
            } else {
                str += "word" + array[i] + "#";
            }
        }
        return str;
    }
}